//
// Created by 李光辉 on 2020/12/31.
//

double local_start,local_finish,local_elapsed,elapsed;
...
MPI_Barrier(comm);
local_start = MPI_Wtime();
...
local_finish = MPI_Wtime();
local_elapsed = local_finish - local_start;

MPI_Reduce(&local_elapsed,&elapsed,1,MPI_DOUBLE,MPI_MAX,0,comm);

if(my_rank == 0)
printf("%e \n",elapsed);

